import store from "@/store";
// 需要指定按钮要求添加权限,如v-permission="['svg']"
const permission = {
  inserted(el, binding) {
    const { arg: permission } = binding;
    const permissionMenu = store.getters.permissionMenu || [];
    let hasPermission = false;
    for(let o of permission) {
      if (permissionMenu.includes(o)) {
        hasPermission = true;
        break;
      }
    }
    // 如果没有权限删除当前dom
    if (!hasPermission) {
      el.parentNode && el.parentNode.removeChild(el);
    }
  }
};
export default permission;